package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.entity.ZsYicipinRuku;
import com.lrkj.back.entity.ZsYicipinRukumingxi;
import com.lrkj.back.mapper.ZsYicipinRukuMapper;
import com.lrkj.back.mapper.ZsYicipinRukumingxiMapper;
import com.lrkj.back.service.ZsYicipinRukuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service("rukuservice")
public class ZsYicipinRukuServiceImpl extends ParentServiceImpl<ZsYicipinRuku> implements ZsYicipinRukuService {
    @Autowired
    private ZsYicipinRukuMapper rukuMapper;
    @Autowired
    private ZsYicipinRukumingxiMapper rukumingxiMapper;

    @Override
    public PageInfo<ZsYicipinRuku> findAllYicipin(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<ZsYicipinRuku> dataList = rukuMapper.findAllYicipin(map);
        PageInfo<ZsYicipinRuku> page = new PageInfo<ZsYicipinRuku>(dataList);
        return page;
    }

    @Override
    protected DBInterface<ZsYicipinRuku> getDao() throws DBException {
        return rukuMapper;
    }

    @Override
    public List<ZsYicipinRukumingxi> findAllYicipinDetail(Map<String, Object> map) throws DBException {
        List<ZsYicipinRukumingxi> mxList = rukumingxiMapper.findAllYicipinDetail(map);
        return mxList;
    }

    @Override
    public List<ZsYicipinRuku> findAllYicipinNopage(Map<String, Object> map) throws DBException {
        return rukuMapper.findAllYicipin(map);
    }

}
